package com.code.leetcode.offer;

import java.util.ArrayList;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/8/6 16:30
 */
public class The62 {
    public int lastRemaining(int n, int m) {
        int ants = 0;
        for (int i = 2; i <= n; i++) {
            ants = (ants + m) % i;
        }
        return ants;
    }

}
